home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_q_t / trem.zip / DESTROY.C < prev    next >
Text File  |  1991-05-11  |  2KB  |  63 lines

  1. /************************************************************************
  2.  *
  3.  *    Copyright (c) 1991 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *-----------------------------------------------------------------------
  6.  *
  7.  *     Project:  Windows Terminal Example
  8.  *
  9.  *      Module:  destroy.c
  10.  *
  11.  *      Author:  Bryan A. Woodruff (baw)
  12.  *
  13.  *
  14.  *     Remarks:  Destroy terminal information block
  15.  *
  16.  *   Revisions:  
  17.  *     01.00.000  5/ 9/91 baw   Wrote it
  18.  *
  19.  ************************************************************************/
  20.  
  21. #include "terminal.h"
  22.  
  23. /************************************************************************
  24.  *  BOOL DestroyTerminal( LOCALHANDLE hTermInfo )
  25.  *
  26.  *  Description:
  27.  *     Destroys block associated with hTermInfo handle.
  28.  *
  29.  *  Comments:
  30.  *      5/ 8/91  baw  Wrote it
  31.  *
  32.  ************************************************************************/
  33.  
  34. BOOL DestroyTerminal( HWND hWnd )
  35. {
  36.    HDC          hDC ;
  37.    LOCALHANDLE  hTermInfo ;
  38.    NPTERMINFO   npTermInfo ;
  39.  
  40.    hTermInfo = GetWindowWord( hWnd, GWW_TERMINFO ) ;
  41.    if (NULL == (npTermInfo = (NPTERMINFO) LocalLock( hTermInfo )))
  42.       return ( FALSE ) ;
  43.  
  44.    if (npTermInfo -> fConnected)
  45.       CloseConnection( hWnd ) ;
  46.  
  47.    hDC = GetDC( hWnd ) ;
  48.    SelectObject( hDC, npTermInfo -> hDefaultFont ) ;
  49.    DeleteObject( npTermInfo -> hFont ) ;
  50.    ReleaseDC( hWnd, hDC ) ;
  51.  
  52.    LocalUnlock( hTermInfo ) ;
  53.    LocalFree( hTermInfo ) ;
  54.  
  55.    return ( TRUE ) ;
  56.  
  57. } /* end of DestroyTerminal() */
  58.  
  59. /************************************************************************
  60.  * End of File: destroy.c
  61.  ************************************************************************/
  62.  
  63.